#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<unordered_map>
using namespace std;

void solve()
{
    int n, k; cin >> n >> k;
    vector<int> arr;
    for (int i = 0; i < k; i++)
    {
        int temp; cin >> temp;
        arr.push_back(temp);
    }
    sort(arr.begin(), arr.end());
    int ans = 0;
    for (int i = 0; i < arr.size() - 1; i++)
    {
        ans += 2 * arr[i] - 1;
    }
    cout << ans << endl;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int t; cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}